package com.example.helloworld;

import java.util.Calendar;
import java.util.Date;

public class DiffDemo {
    public static void main(String[] args) {
        try {
            long startTime = System.currentTimeMillis();
            System.out.println("Start time: " + new Date(startTime));
            Thread.sleep(5000);
            long endTime = System.currentTimeMillis();
            System.out.println("End time: " + new Date(endTime));
            long diffTime = endTime - startTime;
            System.out.println("Difference in time: " + diffTime);

            Calendar cal1 = Calendar.getInstance();
            cal1.set(2021, Calendar.JANUARY, 1);
            System.out.println(cal1.getTime());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
